In [1]:
import numpy as np
#import time
#from scipy.stats import chi2
from matplotlib import pyplot as plt
from __future__ import division
#from itertools import product
from spacetime.CA_Simulators.CAs import *
from spacetime.Local_Measures.Local_Complexity import *
from spacetime.Local_Measures.Spacetime_Information import *
%matplotlib inline
In [2]:
np.random.seed(0)
lc_test = np.random.choice([0,1],(10,10))
print lc_test
In [10]:
plcs = pure_PLCs(3, 1, 2)
plcs.scan_data(lc_test)
label = plcs.all_labels()[4][2]
config = plcs.all_configs()[4][2]
print label
print config
print plcs.map_to_label(config)
print plcs.map_to_config(label)
print plcs.get_config_str((4,2))
print plcs.get_label((4,2))
In [4]:
flcs = pure_FLCs(3, 1, 2)
flcs.scan_data(lc_test)
Flabel = flcs.all_labels()[4][2]
Fconfig = flcs.all_configs()[4][2]
print Flabel
print Fconfig
print flcs.map_to_label(Fconfig)
print flcs.map_to_config(Flabel)
print flcs.get_label((4,2))
print flcs.get_config_str((4,2))
In [5]:
test_field = np.zeros((10,10), dtype = int)
fill = np.ones((2,10),dtype = int)
test_field = np.vstack((fill,test_field,fill))
time, space = np.shape(test_field)
test_field[2]+=2
test_field[11]+=2
print test_field
In [6]:
test = information_field(test_field,3,2,1)
In [7]:
print test.past()
In [8]:
print test.present()
In [9]:
print test.future()
In [10]:
print test.h_mu()
print test.h_mu_slow()
print np.mean(test.h_field())
In [11]:
test.h_field()
Out[11]:
In [12]:
print test.b_mu()
print test.b_mu_slow()
print np.mean(test.b_field())
In [13]:
test.b_field()
Out[13]:
In [14]:
print test.q_mu()
print test.q_mu_slow()
print np.mean(test.q_field())
In [15]:
test.q_field()
Out[15]:
In [16]:
print test.sigma_mu()
print test.sigma_mu_slow()
print np.mean(test.sigma_field())
In [17]:
test.sigma_field()
Out[17]:
In [18]:
ee_test = local_excess_entropy(test_field, 0)
In [19]:
ee_test.estimate_states(2,1)
In [20]:
print ee_test.forward_state_field()
In [21]:
print ee_test.reverse_state_field()
In [22]:
print np.shape(ee_test.forward_state_field())
print np.shape(ee_test.reverse_state_field())
In [23]:
print ee_test.forward_state_field()
In [24]:
print ee_test.reverse_state_field()[::-1]
In [25]:
for i in xrange(10):
print ee_test.joint_state_field()[i]
In [26]:
dist_test = ee_test.joint_state_dist()
for item in dist_test.items():
print item
In [27]:
print ee_test.excess_entropy()
In [28]:
print np.mean(ee_test.excess_entropy_field())
In [29]:
print ee_test.excess_entropy_field()
In [30]:
print np.shape(ee_test.excess_entropy_field())
In [ ]:
In [31]:
t = 100
start_a = domain_54(4*t, 'a')
start_b = domain_54(4*t, 'd')
start_c = domain_54(4*t, 'c')
start = np.hstack((start_a,start_b, start_c))
more_particles = ECA(54, start)
more_particles.evolve(12*t)
In [32]:
particle_states = epsilon_field(more_particles.get_spacetime())
past = 3
future = 3
c = 1
particle_states.estimate_states(past,future,c)
particle_states.filter_data()
In [33]:
info_54 = information_field(more_particles.get_spacetime(),3,3,1)
In [ ]:
ee_18 = local_excess_entropy(more_particles.get_spacetime(), 0)
ee_18.estimate_states(3,1)
In [ ]:
diagram(particle_states.complexity_field(),t_min = 190, t_max = 210, x_min=590, x_max=610, colorbar = True)
In [ ]:
diagram(ee_18.excess_entropy_field(),t_min = 184, t_max = 204, x_min=590, x_max=610, colorbar = True)
In [ ]:
diagram(info_54.sigma_field(),t_min = 186, t_max = 206, x_min=590, x_max=610, colorbar = True)
In [ ]:
diagram(info_54.q_field(),t_min = 186, t_max = 206, x_min=590, x_max=610, colorbar = True, colors = plt.cm.bone)
In [ ]:
diagram(info_54.b_field(),t_min = 186, t_max = 206, x_min=590, x_max=610, colorbar = True, colors=plt.cm.Blues)
In [ ]:
In [ ]:
print np.shape(more_particles.get_spacetime())
In [ ]:
print np.shape(particle_states.get_causal_field())
In [ ]:
print np.shape(info_54.q_field())
In [ ]:
print np.shape(info_54.b_field())
In [ ]:
print np.shape(info_54.sigma_field())
In [ ]:
print np.shape(ee_18.excess_entropy_field())
In [ ]:
print np.shape(particle_states.complexity_field())
In [ ]: